<template>
  <div class="kpi-card" :class="{ 'kpi-orange': orange, 'kpi-green': green }">
    <div class="kpi-label">{{ label }}</div>
    <div class="kpi-value">{{ value }}</div>
    <div v-if="change" class="kpi-change" :class="{ 'positive': change > 0, 'negative': change < 0 }">
      {{ change > 0 ? '↑' : '↓' }} {{ Math.abs(change) }}%
    </div>
  </div>
</template>

<script setup>
defineProps({
  label: {
    type: String,
    required: true
  },
  value: {
    type: [String, Number],
    required: true
  },
  change: {
    type: Number,
    default: null
  },
  orange: {
    type: Boolean,
    default: false
  },
  green: {
    type: Boolean,
    default: false
  }
})
</script>

<style scoped>
.kpi-card {
  background: rgba(15, 25, 45, 0.6);
  border: 1px solid rgba(24, 144, 255, 0.3);
  border-radius: 8px;
  text-align: center;
  transition: all 0.3s;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.kpi-card:hover {
  border-color: rgba(24, 144, 255, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(24, 144, 255, 0.2);
}

.kpi-label {
  font-size: 12px;
  color: #000;
  background: #389e0d;
  padding: 6px;
  font-weight: 500;
  width: 100%;
}

.kpi-value {
  font-size: 28px;
  font-weight: bold;
  color: #1890ff;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-card.kpi-orange .kpi-value {
  color: #ff9800;
}

.kpi-card.kpi-green .kpi-value {
  color: #52c41a;
}

.kpi-change {
  font-size: 12px;
  margin-top: 5px;
}

.kpi-change.positive {
  color: #52c41a;
}

.kpi-change.negative {
  color: #ff4d4f;
}
</style>
